Field of the Invention
The present invention relates to a ranging apparatus, an imaging apparatus, and a ranging method.
Description of the Related Art
Japanese Patent Application Publication No. 2003-244712 suggests a solid-state imaging sensor for a digital still camera or a digital video camera in which pixels having a ranging function (referred to hereinbelow as “ranging pixels”) are arranged in the entire imaging sensor or part thereof, and the distance to an object is detected by a phase difference method. The ranging pixels are equipped with a plurality of photoelectric conversion units and configured such that light fluxes that have passed through different regions on a lens pupil are guided to different photoelectric conversion units.
Picture image data (a picture image based on an A-image is referred to hereinbelow as “A-picture image”, and a picture image based on a B-image is referred to hereinbelow as “B-picture image”) based on optical images (referred to hereinbelow as “A-image” and “B-image”; a combination of those picture images is referred to as “AB-images”) generated by light fluxes that have passed through different pupil regions are acquired by using electric signals generated by the photoelectric conversion units included in the ranging pixels. An image shift amount (also referred to as “parallax”), which is a relative position shift amount of the A-picture image and B-picture image, is then calculated.
A large number of techniques for searching for correspondence points in a region base, which is called template matching, is used for calculating the image shift amount. In template matching, an A-picture image or a B-picture image is set as a criterion picture image, and the other picture image, which is different from the criterion picture image, is set as a reference picture image. A criterion region (also referred to as “criterion window”) centered on a point of interest is set on the criterion picture image, and a reference region (also referred to as “reference window”) is also set with respect to a reference point corresponding to the point of interest on the reference picture image. A reference point in which the correlation between the picture image in the criterion region and the picture image in the reference region reaches a maximum is retrieved, and an image shift amount is calculated using the relative position shift amount of the point of interest and the reference point. Generally, where the size of the search region decreases, local calculations cause a calculation error of the image shift amount. For this reason, a comparative large region size (for example, 9 pixels×9 pixels, or the like) is used.
The distance to an object can be calculated by converting the image shift amount into a defocus amount by using a conversion coefficient. In such a way, since it is not necessary to move a lens in order to measure the distance, as opposed to the conventional contrast method, high-speed and high-accuracy ranging can be performed.
In this case, the ranging accuracy during measurements can be increased by accurately determining the image shift amount. The collapse of the light quantity balance is one of the factors causing an error in the image shift amount. The collapse of the light quantity balance, as referred to herein, is a phenomenon in which the light quantity ratio of the A-image and B-image varies according to the image height due to light flux vignetting, which is caused by the lens frame of a lens, or caused by the angle characteristic of ranging pixel sensitivity.
Japanese Patent Application Publication No. H2-181108 suggests a method in which a correction coefficient that ensures a constant light quantity ratio of the A-image and B-image is calculated by performing uniform irradiation after assembling a lens and an imaging sensor, and picture image data are then corrected using this correction coefficient when calculating the image shift amount.
Japanese Patent Application Publication No. 2009-258231 suggests a method for correcting the collapse of the light quantity balance by correlation computations taking the light quantity ratio of the A-image and B-image into account.